package service.impl;

import dao.CustomerMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import pojo.Customer;
import pojo.Page;
import service.CustomerService;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName 刘星宇
 * @Description TODO
 * @date 2022/12/2 11:33
 * @Version 1.0
 */
@Service
public class CustomerServiceImpl implements CustomerService {
    @Resource
    private CustomerMapper customerMapper;
    //总条数
    @Override
    public int getCount1(Page<Customer> page, Customer customer) {
        return customerMapper.getCount1(page, customer);
    }
    //分页
    @Override
    public List<Customer> customerAllByPage(Page<Customer> page, Customer customer) {
        return customerMapper.customerAllByPage(page, customer);
    }
    //修改
    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public int AddCustomer(Customer customer) {
        return customerMapper.AddCustomer(customer);
    }
    //修改
    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public int UpdateCustomer(Customer customer) {
        return customerMapper.UpdateCustomer(customer);
    }
    //删除
    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public int DelCustomer(String customerCode) {
        int i = customerMapper.DelCustomer(customerCode);
        return i;
    }

    @Override
    public int getCount(Customer customer) {
        return 0;
    }

    @Override
    public List<Customer> getAllByPage(Page<Customer> p, Customer customer) {
        return null;
    }

    @Override
    public void add(Customer customer) {

    }

    @Override
    public void del(Customer customer) {

    }

    @Override
    public void update(Customer customer) {

    }

    @Override
    public List<Customer> getAll() {
        return null;
    }

    @Override
    public List<Customer> getAll1() {
        return customerMapper.getAll1();
    }
}
